import { formatTwoStageRoutes, formatFlatteningRoutes } from '@/router/index';
import { dynamicRoutes } from '@/router/route';
import pinia from '@/stores/index';
import { useTagsViewRoutes } from '@/stores/tagsViewRoutes';
import { useRoutesList } from '@/stores/routesList';

// 设置路由信息到缓存中
export function setRouteListToStore() {
	// 设定菜单缓存
	const storesRoutesList = useRoutesList(pinia);
	storesRoutesList.setRoutesList(dynamicRoutes[0].children as Array<any>);

	// 设定TagView缓存
	const storesTagsView = useTagsViewRoutes(pinia);
	storesTagsView.setTagsViewRoutes(formatTwoStageRoutes(formatFlatteningRoutes(dynamicRoutes))[0].children);
}